<?php 
$j = 0;
if($adc->CurrentAd->getCatId() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('category'));
	$rows[0][$j]['value'] = '<a href="'.$katana->getURL().'/adcat/'.$adc->CurrentAd->getCatId().'/adbrand/'.$adc->CurrentAd->getBrandId().'/">';
	if($adc->CurrentAd->getDisplayIsNew())
	{
		if($adc->CurrentAd->getIsNew() == 0)
		{ $rows[0][$j]['value'] .= ucfirst($txt->getWord('used')).' '; }
	}
	
	$rows[0][$j]['value'] .= $adc->CurrentAd->getBrandTitle().' '.$adc->CurrentAd->getCatTitle().'</a>';
	$j++;
}

$rows[0][$j]['label'] = ucfirst($txt->getWord('type'));
$rows[0][$j]['value'] = ucfirst($adc->CurrentAd->getIsBuyingText());

if($adc->CurrentAd->getDisplayIsNew())
{
	if($adc->CurrentAd->getIsNew())
	{ $rows[0][$j]['value'] .= ' - '.ucfirst($txt->getWord('new')); }
	else
	{ $rows[0][$j]['value'] .= ' - '.ucfirst($txt->getWord('used')); }
}

$j++;

/*
if($adc->CurrentAd->getBrandId() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('brand'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getBrandTitle();
	$j++;
}
*/
if($adc->CurrentAd->getModId())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('model'));
	$rows[0][$j]['value'] = '<a href="'.$katana->getURL().'/adbrand/'.$adc->CurrentAd->getBrandId().'/model/'.$adc->CurrentAd->getModId().'/">';
	$rows[0][$j]['value'] .= $adc->CurrentAd->getBrandTitle().' '.$adc->CurrentAd->getModTitle().'</a>';
	$j++;
}
if($adc->CurrentAd->getYear() > 0)
{
	if($adc->getCurrentAd()->getIsBuying())
	{ $rows[0][$j]['label'] = ucfirst($txt->getWord('year_production').' '.$txt->getWord('from')); }
	else
	{ $rows[0][$j]['label'] = ucfirst($txt->getWord('year_production')); }
	$rows[0][$j]['value'] = $adc->CurrentAd->getYear().' ';
	$j++;
}

$rows[0][$j]['label'] = '&nbsp;';
$rows[0][$j]['value'] = '';
$j++;

if($adc->CurrentAd->getFirstTimeReg())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('first_time_registered'));
	$rows[0][$j]['value'] = $adc->formatDate($adc->CurrentAd->getFirstTimeReg(), 'd.m.Y');
	$j++;
}
if($adc->CurrentAd->getRegNo() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('registration_no'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getRegNo();
	$j++;
}
if($adc->CurrentAd->getTechApproved() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('TechApproved'));
	if($adc->CurrentAd->getTechApproved() > 0)
	{ $rows[0][$j]['value'] = ucfirst($txt->getWord('yes')); }
	else
	{ $rows[0][$j]['value'] = ucfirst($txt->getWord('no')); }
	$j++;
}
if($adc->CurrentAd->getTechApprovedDate() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('TechApproved').' '.$txt->getWord('date'));
	$rows[0][$j]['value'] = $adc->formatDate($adc->CurrentAd->getTechApprovedDate(), 'd.m.Y');
	$j++;
}	

$rows[0][$j]['label'] = '&nbsp;';
$rows[0][$j]['value'] = '';
$j++;


if($adc->CurrentAd->getCeMarked() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('CE_marked'));
	$rows[0][$j]['value'] = ucfirst($txt->getWord('yes'));
	$j++;
}
if($adc->CurrentAd->getConformityDeclaration() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('conformity_declaration'));
	$rows[0][$j]['value'] = ucfirst($txt->getWord('yes'));
	$j++;
}

$rows[0][$j]['label'] = '&nbsp;';
$rows[0][$j]['value'] = '';
$j++;

if($adc->CurrentAd->getCabinType() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('cottage_type'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getCabinType();
	$j++;
}
if($adc->CurrentAd->getShaftType() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('shaft_type'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getShaftType();
	$j++;
}

if($adc->CurrentAd->getSuspensionFront() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('suspension_type').' '.$txt->getWord('front'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getSuspensionFront();
	$j++;
}
if($adc->CurrentAd->getSuspensionRear() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('suspension_type').' '.$txt->getWord('rear'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getSuspensionRear();
	$j++;
}

// LEFT SIDE COMPLETE
$j = 0;

if($adc->CurrentAd->getLengthUsed() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')); }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('mileage'));
	
	$rows[1][$j]['value'] = $adc->CurrentAd->getLengthUsed();
	$rows[1][$j]['unit'] = '&nbsp;km';
	$j++;
}
if($adc->CurrentAd->getPower() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('min')); }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('horsepower'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getPower();
	$j++;
}
if($adc->CurrentAd->getVolume() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('min')); }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('engine_volume'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getVolume();
	$rows[1][$j]['unit'] = 'cm&sup3;';
	$j++;
}
if($adc->CurrentAd->getFuelType() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('FuelType'));
	switch($adc->CurrentAd->getFuelType())
	{
		case 1:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Bensin'));
			break;
		case 2:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Diesel'));
			break;
		case 3:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Gass'));
			break;
		case 4:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Elektro'));
			break;
		case 5:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Hybrid'));
			break;
	}
	$j++;
}
if($adc->CurrentAd->getGearType() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('GearType'));
	switch($adc->CurrentAd->getGearType())
	{
		case 1:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Manual'));
			break;
		case 2:
			$rows[1][$j]['value'] = ucfirst($txt->getWord('Automat'));
			break;
	}
	if($adc->CurrentAd->getGearTypeTxt() != '')
	{ $rows[1][$j]['value'] .= ' - '.ucfirst($adc->CurrentAd->getGearTypeTxt()); }
	$j++;
}

$rows[1][$j]['label'] = '&nbsp;';
$rows[1][$j]['value'] = '';
$j++;

if($adc->CurrentAd->getCountSeats() > 0)
{
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('CountSeats'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getCountSeats();
	$j++;
}
if($adc->CurrentAd->getCountDoors() > 0)
{
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('CountDoors'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getCountDoors();
	$j++;
}

if($adc->CurrentAd->getColorId() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('color'));
	$colors =  $adc->getSetting('Colors');
	$rows[1][$j]['value'] = $colors[$adc->CurrentAd->getColorId()];
	
	if($adc->CurrentAd->getColorTxt() != '')
	{ $rows[1][$j]['value'] .= ' - '.ucfirst($adc->CurrentAd->getColorTxt()); }
	$j++;
}

if($adc->CurrentAd->getLoadCapacityWeight() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('load_capacity'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getLoadCapacityWeight();
	$rows[1][$j]['unit'] = 'kg';
	$j++;
}
if($adc->CurrentAd->getLoadCapacityVolume() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('load_capacity'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getLoadCapacityVolume();
	$rows[1][$j]['unit'] = 'm&sup3;';
	$j++;
}
if($adc->CurrentAd->getWheelbase() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('wheelbase'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getWheelbase();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}
if($adc->CurrentAd->getInsideLength() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('inside_length'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getInsideLength();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}
if($adc->CurrentAd->getInsideWidth() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('inside_width'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getInsideWidth();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}

$rows[1][$j]['label'] = '&nbsp;';
$rows[1][$j]['value'] = '';
$j++;

$j = 0;

if(is_array(get_object_vars($adc->CurrentAd)))
{
	foreach(array_keys(get_object_vars($adc->CurrentAd)) as $var)
	{
		switch($var)
		{
			case 'ABS':
			case 'AirbagFront':
			case 'AirbagSide':
			case 'Alarm':
			case 'DiffLock':
			case 'TractionControll':
			case 'AntiSlipRegulation':
			case 'EngineImmobilizer':
			case 'SteelBeams':
				if($adc->CurrentAd->$var > 0)
				{ 
					$rows[2][$j]['label'] = ucfirst($txt->getWord($var));
					$rows[2][$j]['value'] = $okIcon;
					$j++;
				}
			break;
		}
	}
	foreach(array_keys(get_object_vars($adc->CurrentAd)) as $var)
	{
		switch($var)
		{
			/* Equipement */
			case 'RemovableHitch':
			case 'DieselParticleFilter':
			case 'AllSeasonTires':
			case 'Hitch':
			case 'CargoHolder':
			case 'LightAlloyWheelsSummer':
			case 'LightAlloyWheelsWinter':
			case 'AirSuspension':
			case 'MetallicPaint':
			case 'LevelControll':
			case 'ParkingSensorFront':
			case 'ParkingSensorRear':
			case 'WheelsSummer':
			case 'WheelsWinter':
			case 'RoofRails':
			case 'XenonHeadlight':
				if($adc->CurrentAd->$var > 0)
				{ 
					$rows[3][$j]['label'] = ucfirst($txt->getWord($var));
					$rows[3][$j]['value'] = $okIcon;
					$j++;
				}
			break;
		}
	}
	foreach(array_keys(get_object_vars($adc->CurrentAd)) as $var)
	{
		switch($var)
		{	
			/* Comfort */
			case 'AirCon':
			case 'BaggageCover':
			case 'CdChanger':
			case 'CruiseControl':
			case 'PartialLeather':
			case 'DVD':
			case 'PowerSeat':
			case 'PowerSeatMemory':
			case 'PowerMirrors':
			case 'PowerWindows':
			case 'TintedGlass':
			case 'Handsfree':
			case 'KeylessGo':
			case 'TripComputer':
			case 'CentreArmrest':
			case 'EngineHeater':
			case 'MultifunctionSteering':
			case 'GPS':
			case 'HeatedSeats':
			case 'RadioCD':
			case 'RainSensor':
			case 'CentralLock':
			case 'Servo':
			case 'LeatherInterior':
			case 'SportSeats':
			case 'Sunroof':
			case 'Tv':
				if($adc->CurrentAd->$var > 0)
				{ 
					if($var == 'AirCon')
					{ $rows[4][$j]['label'] = ucfirst($txt->getWord('Air Condition')); }
					else
					{ $rows[4][$j]['label'] = ucfirst($txt->getWord($var)); }
					$rows[4][$j]['value'] = $okIcon;
					$j++;
				}
			break;
		}
	}
}

unset($j);
if($rows > 0)
{
	foreach(array_keys($rows) as $i)
	{
		if(count($rows[$i]) > 0)
		{
			$rows[$i]['table'] = '<table border="0" cellpadding="0" cellspacing="0">';
			foreach(array_keys($rows[$i]) as $j)
			{
				if(is_array($rows[$i][$j]))
				{
					if(is_int($rows[$i][$j]['value']))
					{ $rows[$i][$j]['value'] = number_format($rows[$i][$j]['value'], 0, ',', ' '); }
					
					$rows[$i]['table'] .= 	'<tr>';
					$rows[$i]['table'] .= 		'<td class="left '.$adc->getSetting('AttributeClass').'">'.$rows[$i][$j]['label'].'</td>';
					if($rows[$i][$j]['value'])
					{
						$rows[$i]['table'] .= 		'<td>&nbsp;:&nbsp;&nbsp;</td>';
						$rows[$i]['table'] .= 		'<td class="left '.$adc->getSetting('AttributeValClass').'">'.$rows[$i][$j]['value'].' '.$rows[$i][$j]['unit'].'</td>';
					}
					$rows[$i]['table'] .= 	'</tr>';
				}
			}
			$rows[$i]['table'] .= '</table>';
		}
	}
}
?>
<div class="row">
	<div class="col-md-8 col-sm-8 overflow_hidden"><h3><?php echo $adc->getCurrentAd()->getTitle(); ?></h3></div>
    <div class="col-md-4 col-sm-4 top right medium">
    	<?php 
		if(($adc->CurrentAd->getDisplayPrice() > 0) && ($adc->CurrentAd->getPriceGlobal() > 0))
		{ 
			echo '<h3 itemprop="price">';
			require($adc->getViewPath().'elements/Price.php');
			echo '</h3>';
			echo '<h4 class="price-financed"></h4>';
		}
		?>
        <?php if($adc->getCurrentAd()->getIsCompleted() > 0): ?>
        	<div class="sold float-right">
			<p class="float-left"><?php echo ucfirst($adc->getCurrentAd()->getIsBoughtText()); ?>&nbsp;&nbsp;</p>
			<img src="<?php echo SYSICONS_URL ?>ok_24.png" width="24" height="24" alt="<?php echo ucfirst($adc->getCurrentAd()->getIsBoughtText()); ?>" title="<?php echo ucfirst($txt->getWord('sold')); ?>">
			</div>
        <?php endif; ?>
    </div>
</div>
<h3><?php echo ucfirst($txt->getWord('information')); ?></h3>
<div class="row">
	<div class="col-md-6"><?php  echo $rows[0]['table']; ?></div>
    <div class="col-md-6"><?php  echo $rows[1]['table']; ?></div>
</div>
<?php if($rows[2]): ?>
<div class="row">
	<div class="col-md-4 col-sm-4 col-xs-12"> 
        <h3><?php echo ucfirst($txt->getWord('comfort')); ?></h3>
        <?php  echo $rows[4]['table']; ?><br />
    </div>
    <div class="col-md-4 col-sm-4 col-xs-12"> 
        <h3><?php echo ucfirst($txt->getWord('equipment')); ?></h3>
        <?php  echo $rows[3]['table']; ?><br />
    </div>
   	<div class="col-md-4 col-sm-4 col-xs-12">        	
    	<h3><?php echo ucfirst($txt->getWord('safety')); ?></h3>
		<?php  echo $rows[2]['table']; ?><br />
    </div>
</div>
<?php endif; ?>
<hr />